﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

using SpiritAlight.Scene;
using SpiritAlight.Stage;

namespace SpiritAlight
{
    public class AObstacle
    {

        public AObstacle(Vector2 inPosition)
        {
            position = inPosition;
        }

        virtual public Texture2D Textrue
        {
            get;
            protected set;
        }

        virtual public Vector2 Size
        {
            get;
            protected set;
        }

        virtual public bool IsLoaded
        {
            get;
            protected set;
        }
        virtual public void LoadContent()
        {
            if (!IsLoaded)
                IsLoaded = true;
        }

        public void Draw()
        {
            GameMain.DrawObject(this.Textrue, Coordinate.ScreenToGlobal(position));
        }

        public Vector2 Position { 
            get { return position; }
            set { position = value; } 
        }
        Vector2 position;

        public bool IsIntersect(Vector2 position, Vector2 Size)
        {
            Vector2 buffer = new Vector2(position.X, position.Y);
            //buffer = GameMain.Map.ToScreenCoordinate(buffer);
            if (this.position.X > position.X + Size.X || this.position.X + this.Size.X < position.X ||
                this.position.Y > position.Y + Size.Y || this.position.Y + this.Size.Y < position.Y)
                return false;

            return true;
        }
    }
}
